//
// Created by ubuntu on 19-5-16.
//
#include "MapPoints.h"
using namespace Relocation_Slam;

MapPoint::MapPoint(const cv::Mat &Pos, Frame* pRefKF,int id,int featureId) {
    mPose[0] = Pos.at<float>(0,0);
    mPose[1] = Pos.at<float>(1,0);
    mPose[2] = Pos.at<float>(2,0);
    mnId = id;
    mObservations.insert(make_pair(pRefKF,featureId));
    mDescriptor = pRefKF->mPointDescriptors;
    mnFirstFrame = pRefKF->mnFrameId;
}


map<Frame*, int> MapPoint::GetObservations()
{
    return mObservations;
}

void MapPoint::AddObservation(Frame* pKF, size_t idx)
{
    // 记录下能观测到该MapPoint的KF和该MapPoint在KF中的索引
    mObservations.insert(make_pair(pKF,idx));
    nObs++;
}

